package com.xdtech.trans.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.sql.Timestamp;

import com.xdtech.core.model.BaseItem;
import com.xdtech.core.orm.utils.BeanUtils;
import com.xdtech.trans.model.TransAccount;
import com.xdtech.trans.model.TransWebSite;

import com.xdtech.web.freemark.item.GridColumn;

/**
 * 
 * @author max.zheng
 * @create 2015-06-06 17:37:49
 * @since 1.0
 * @see
 */
public class TransAccountItem extends BaseItem implements Serializable{
	private static final long serialVersionUID = 1L;
	private Long id;
	@GridColumn(title="账户名",width=100)
	private String accountName;
	@GridColumn(title="账户类型",width=100,dictionaryCode="ACCOUNT_TYPE")
	private String accountType;
	@GridColumn(title="开通日期",width=100)
	private String openDate;
	@GridColumn(title="账户余额",width=100)
	private Double accountBalance;
	@GridColumn(title="警戒金额",width=100)
	private Double warnBalance;
	@GridColumn(title="停用金额",width=100)
	private Double stopBalance;
	@GridColumn(title="备注",width=100)
	private String remark;
	@GridColumn(title="联系人",width=100)
	private String contact;
	@GridColumn(title="联系人电话",width=100)
	private String contactPhone;
	@GridColumn(title="网点类型",width=100,dictionaryCode="WEBSITE_TYPE")
	private String websiteType;
	
	private String websiteId;
	@GridColumn(title="网点名称",width=100)
	private String websiteName;
	
	private String websiteIds;

	public void setId(Long id) {
		this.id = id;
		addQuerys("id", id);
	}
	public Long getId() {
		return id;
	}
	
	public String getAccountName() {
		return accountName;
	}
	public void setAccountName(String accountName) {
		this.accountName = accountName;
		addQuerys("accountName", accountName);
	}
	public void setAccountType(String accountType) {
		this.accountType = accountType;
		addQuerys("accountType", accountType);
	}
	public String getAccountType() {
		return accountType;
	}
	
	public void setOpenDate(String openDate) {
		this.openDate = openDate;
		addQuerys("openDate", openDate);
	}
	public String getOpenDate() {
		return openDate;
	}
	
	public void setAccountBalance(Double accountBalance) {
		this.accountBalance = accountBalance;
		addQuerys("accountBalance", accountBalance);
	}
	public Double getAccountBalance() {
		return accountBalance;
	}
	
	public void setWarnBalance(Double warnBalance) {
		this.warnBalance = warnBalance;
		addQuerys("warnBalance", warnBalance);
	}
	public Double getWarnBalance() {
		return warnBalance;
	}
	
	public void setStopBalance(Double stopBalance) {
		this.stopBalance = stopBalance;
		addQuerys("stopBalance", stopBalance);
	}
	public Double getStopBalance() {
		return stopBalance;
	}
	
	public void setRemark(String remark) {
		this.remark = remark;
		addQuerys("remark", remark);
	}
	public String getRemark() {
		return remark;
	}
	
	public void setContact(String contact) {
		this.contact = contact;
		addQuerys("contact", contact);
	}
	public String getContact() {
		return contact;
	}
	
	public void setContactPhone(String contactPhone) {
		this.contactPhone = contactPhone;
		addQuerys("contactPhone", contactPhone);
	}
	public String getContactPhone() {
		return contactPhone;
	}
	
	public String getWebsiteType() {
		return websiteType;
	}
	public void setWebsiteType(String websiteType) {
		this.websiteType = websiteType;
		addQuerys("websiteType", websiteType);
	}
	public String getWebsiteId() {
		return websiteId;
	}
	public void setWebsiteId(String websiteId) {
		this.websiteId = websiteId;
		addQuerys("websiteId", websiteId);
	}
	public String getWebsiteName() {
		return websiteName;
	}
	public void setWebsiteName(String websiteName) {
		this.websiteName = websiteName;
		addQuerys("websiteName", websiteName);
	}
	
	public String getWebsiteIds() {
		return websiteIds;
	}
	public void setWebsiteIds(String websiteIds) {
		this.websiteIds = websiteIds;
		addQuerys("websiteIds", websiteIds);
	}
	/**
	 * 根据model构建vo
	 * 
	 * @author max
	 * @return
	 */
	public static TransAccountItem createItem(TransAccount transAccount) {
		TransAccountItem transAccountItem = new TransAccountItem();
		BeanUtils.copyProperties(transAccountItem, transAccount);
		//自定义属性设置填充
		TransWebSite transWebSite = transAccount.getTransWebSite();
		if (transWebSite!=null) {
			transAccountItem.setWebsiteId(transWebSite.getId().toString());
			transAccountItem.setWebsiteName(transWebSite.getName());
		}
		return transAccountItem;
	}
	/**
	 * 根据model集合创建vo集合
	 * 
	 * @author max
	 * @return
	 */
	public static List<TransAccountItem> createItems(List<TransAccount> transAccounts) {
		List<TransAccountItem> transAccountItems = new ArrayList<TransAccountItem>();
		for (TransAccount transAccount : transAccounts) {
			transAccountItems.add(createItem(transAccount));
		}
		return transAccountItems;
	}
}
